import {defineStore} from "pinia";
import type {TrademarkListType} from "@/api/trademark"
import {reqTrademarkList} from "@/api/trademark";
interface stateType{
    trademarkList:TrademarkListType,
    pages:number,
    total:number
}

export const useTrademarkStore = defineStore("trademark",{
    state:():stateType=>{
        return{
            trademarkList:[],
            pages:0,
            total:0
        }
    },
    actions:{
         async getTrademarkList(page:number,limit:number){
            try {
               const result =  await reqTrademarkList(page,limit)
               this.trademarkList = result.records
               this.pages = result.pages
               this.total = result.total
            }catch (e){
                return Promise.reject(e)
            }
        }
    }
})